export default function filterArray (data, parent) {
    var tree = []
    var temp
    for (var i = 0; i < data.length; i++) {
      if (data[i].parentId == parent) {
        var obj = data[i]
        temp = filterArray(data, data[i].id)
        if (temp.length > 0) {
          obj.children = temp
        }else {
			obj.children = []
		}
        tree.push(obj)
      }
    }
    return tree
}